//
//  APListView_VM_Protocol.swift
//  APSwift
//
//  Created by jianbo.pei on 2023/3/29.
//

import Foundation

protocol APListView_VM_Protocol {
    
    var datasOfCell: [Any]? { get set }
    
    var datasOfSection: [Any]? { get set }
    
    /// 设置section的数量
    /// - Returns: section的数量
    func sectionCount() -> Int
    
    /// 根据indexPath获取数据模型model，不能是VM
    /// - Parameter indexPath: indexPath
    /// - Returns: 数据模型model
    func model(at indexPath: IndexPath) -> Any?
    
    /// 根据indexPath获取对应的cell重用视图
    /// - Parameter indexPath: indexPath
    /// - Returns: cell重用视图
    func cellClass(at indexPath: IndexPath) -> AnyClass?
    
    func modelOfReuseHeaderView(in section: Int) -> Any?
    func modelOfReuseFooterView(in section: Int) -> Any?
    func reuseHeaderViewClass(in section: Int) -> AnyClass?
    func reuseFooterViewClass(in section: Int) -> AnyClass?

}

extension APListView_VM_Protocol {
    func modelOfReuseHeaderView(in section: Int) -> Any? { return nil }
    func modelOfReuseFooterView(in section: Int) -> Any? { return nil }
    func reuseHeaderViewClass(in section: Int) -> AnyClass? { return nil }
    func reuseFooterViewClass(in section: Int) -> AnyClass? { return nil }
}
